package dialogs;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.administrator.newxlmedical.BitmapActivity;
import com.example.administrator.newxlmedical.R;

import java.util.ArrayList;

import beans.RegisterInfoBean;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import constants.Constants;
import custom.MyDialog;
import netframe.NetAddress;

/**
 * Created by Administrator on 2018/5/16.
 */

public class FactoryRegisterInfoDialog extends MyDialog {
    @BindView(R.id.tv_dialog_factory_register_info_name)
    TextView tvName;
    @BindView(R.id.tv_dialog_factory_register_info_company)
    TextView tvCompany;
    @BindView(R.id.tv_dialog_factory_register_info_cancle)
    TextView tvCancle;
    @BindView(R.id.tv_dialog_factory_register_info_sure)
    TextView tvSure;

    private Context mContext;
    private RegisterInfoBean bean;
    private OnClickListener onClickListener;
//    private ArrayList<String> imagePathList = new ArrayList<>();

    public FactoryRegisterInfoDialog(@NonNull Context context, @StyleRes int themeResId, RegisterInfoBean bean, OnClickListener onClickListener) {
        super(context, themeResId);
        this.bean = bean;
        this.mContext = context;
        this.onClickListener=onClickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_factory_register_info);
        ButterKnife.bind(this);

        tvName.setText(bean.getName());
//        tvCompany.setText(bean.getCompany());
//        tvIdNumber.setText(bean.getIdNumber());

//        imagePathList.add(NetAddress.IMAGE_PATH + bean.getCardPositive());
//        imagePathList.add(NetAddress.IMAGE_PATH + bean.getCardOppositive());
//        imagePathList.add(NetAddress.IMAGE_PATH + bean.getCardQualification());
//        RequestOptions options = new RequestOptions().placeholder(R.mipmap.ic_launcher).error(R.mipmap.ic_launcher);
//        Glide.with(mContext).load(NetAddress.IMAGE_PATH + bean.getCardPositive()).apply(options).into(ivCardPositive);
//        Glide.with(mContext).load(NetAddress.IMAGE_PATH + bean.getCardOppositive()).apply(options).into(ivCardOpposite);
//        Glide.with(mContext).load(NetAddress.IMAGE_PATH + bean.getCardQualification()).apply(options).into(ivCardQualification);
    }

    @OnClick({R.id.tv_dialog_factory_register_info_cancle, R.id.tv_dialog_factory_register_info_sure})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_dialog_factory_register_info_cancle:
                dismiss();
                break;
            case R.id.tv_dialog_factory_register_info_sure:
                onClickListener.onSureClickListener(this);
                break;
        }
    }
//    private void imageClick(int position) {
//        Intent intent = new Intent(mContext, BitmapActivity.class);
//        intent.putStringArrayListExtra(Constants.IMAGE_PATH, imagePathList);
//        intent.putExtra(Constants.IMAGE_POSITION, position);
//        mContext.startActivity(intent);
//    }
    public interface OnClickListener{
        void onSureClickListener(FactoryRegisterInfoDialog dialog);
    }
}
